package com.ruoyi.system.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Area;
import com.ruoyi.system.service.IAreaService;
import com.ruoyi.system.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 全国省市区经纬度字典Controller
 *
 * @author ruoyi
 * @date 2025-04-27
 */
@RestController
@RequestMapping("/system/report")
public class ReportController extends BaseController
{
    @Autowired
    private ReportService reportService;

    /**
     * 根据点位和垃圾桶id统计各个垃圾分别的收录重量和容量
     */
    @RequestMapping("/selectLaunchByMaterial")
    public AjaxResult selectLaunchByMaterial(@RequestParam(value = "pointId",required = false) Long pointId,
                                             @RequestParam(value = "trashId",required = false) Long trashId,
                                             @RequestParam(value = "launchDate",required = false) String launchDate)
    {
        return success(reportService.selectLaunchByMaterial(pointId,trashId,launchDate));
    }


    /**
     * 查询每个点位垃圾总量按照点位分组  可以根据投放日期来查询
     */
    @RequestMapping("/selectLaunchByPoint")
    public AjaxResult selectLaunchByPoint(@RequestParam(value = "launchDate",required = false) String launchDate)
    {
        return success(reportService.selectLaunchByPoint(launchDate));
    }



    /**
     * 报表：根据日期，垃圾 统计某种类型垃圾根据日期的分组的变化
     */
    @RequestMapping("/selectLaunchByDate")
    public AjaxResult selectLaunchByDate(
            @RequestParam(value = "pointId",required = false) Long pointId,
            @RequestParam(value = "trashId",required = false) Long trashId,
            @RequestParam(value = "launchDate",required = false) String launchDate,
            @RequestParam(value = "materialId",required = false) Long materialId

    )
    {
        return success(reportService.selectLaunchByDate(pointId,trashId,launchDate,materialId));
    }



    /**
     * 报表：根据垃圾桶类型汇总各个重量容量总和
     */
    @RequestMapping("/selectLaunchByType")
    public AjaxResult selectLaunchByType()
    {
        return success(reportService.selectLaunchByType());
    }



    /**
     * 报表：区分各个垃圾分别投放了多少重量
     */
    @RequestMapping("/selectLaunchByMaterialId")
    public AjaxResult selectLaunchByMaterialId()
    {
        return success(reportService.selectLaunchByMaterialId());
    }

}
